package dproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class LogHandler implements InvocationHandler{
	Object obj;
	
	public LogHandler(Object obj){
		this.obj = obj;
	}

	public Object invoke(Object obj1, Method method, Object[] args)
			throws Throwable {
		this.doBefore();
		Object o = method.invoke(obj, args);
		this.doAfter();
		return o;
	}
	
	public void doBefore(){
		System.out.println("------调用代理类前 ，before-------");
	}
	public void doAfter(){
		System.out.println("------调用代理类前 ，after-------");
	}
}
